class Opponent <  Player

  def initialize
    super('Laptop')
  end

  def decide_attack(table_cards, is_end_game)
			attacking_list = []
      @source.each{ |card|
				if ( is_equal_rank?(table_cards, card) )
          attacking_list.push(card)
        end
			}

			if (attacking_list.empty?)
				return nil
      end

			result = get_card_with_lowest_value_in_the_set(attacking_list)

      if ( result.isTrump  && !is_end_game )
        result = nil
      end

			return result
  end

  def decide_defending(attackingCard)
    #list opponent's  cards stronger than attackingCard
    defendingList = @source.select{ |item| attackingCard.compareIsStronger(item) }

    if defendingList.empty?
        return nil
    end

    return get_card_with_lowest_value_in_the_set(defendingList)
  end

end